<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <script type="text/javascript" src="../web/js/jquery/jquery-1.4.2.js"></script>
    <script type="text/javascript" src="../web/js/stringformat.1.02/stringformat.js"></script>
    <script type="text/javascript" src="../web/js/input-wizard.js"></script>
</head>

<body>
<form action="/formHandler">
    <table>
        <tr>
            <td><label for="id1">Currency:</label></td>
            <td><input id="id1" name="id" type="text" fmt="$#,##0.00" value="100000"></td>
        </tr>
        <tr>
            <td><label for="id1">Percentage:</label></td>
            <td><input id="id1" name="id" type="text" fmt="#0.00#%" value="100000"></td>
        </tr>
        <tr>
            <td><label for="id1">double:</label></td>
            <td><input id="id1" name="id" type="text" fmt="00.00" value="1"></td>
        </tr>
        <tr>
            <td><label for="id1">double:</label></td>
            <td><input id="id1" name="id" type="text" fmt="0.00" value="0.01"></td>
        </tr>
        <tr>
            <td><label for="id1">phone:</label></td>
            <td><input id="id1" name="id" type="text" fmt="(###)###-####" value="00112312"></td>
        </tr>

    </table>
</form>

<script type="text/javascript">
    IW.attach("input");
    jQuery("input").each(function(i, v) {
        var fmt = v.fmt;
        var s = "{0:"+fmt+"}";
        //alert(s);
        var xv = v.value;
        alert(typeof v.value);
        if (typeof v.value.format === 'function') {
            alert(v.value.format(fmt));
         }
        var vv = String.format(s, v.value);
        //alert(vv);
        v.value = vv;
    });
</script>

</body>
</html>